package cn.donting.plugin.spring.boot.starter.plugin.autoconfiguration.resource;

import cn.donting.plugin.spring.boot.starter.PluginWrapper;
import cn.donting.plugin.spring.boot.starter.configuration.MainApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;
import java.util.Map;

/**
 * 向插件中注入主程序 资源类
 *
 * @author donting
 * 2020-06-23 16:04
 * @see PluginResource
 */
@Configuration
public class PluginMainResourceConfiguration {

    public PluginMainResourceConfiguration() {

    }

    @Bean
    public PluginMainResource mainResource(PluginWrapper pluginWrapper)  {
        Map<String, PluginResource> pluginResourceMap = MainApplication.getBeansOfType(PluginResource.class);
        return new PluginMainResource(pluginResourceMap);
    }




}
